<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1" xml:lang="en">
  <title id="gk143896">pg_depend</title>
  <body>
    <p>The <codeph>pg_depend</codeph> system catalog table records the dependency relationships
      between database objects. This information allows <codeph>DROP</codeph> commands to find which
      other objects must be dropped by <codeph>DROP CASCADE</codeph> or prevent dropping in the
        <codeph>DROP RESTRICT</codeph> case. See also <xref href="pg_shdepend.xml#topic1"
        >pg_shdepend</xref>, which performs a similar function for dependencies involving objects
      that are shared across a Greenplum system. </p>
    <p>In all cases, a <codeph>pg_depend</codeph> entry indicates that the referenced object may not
      be dropped without also dropping the dependent object. However, there are several subflavors
      identified by <codeph>deptype</codeph>: </p>
    <ul>
      <li id="gk155721"><b>DEPENDENCY_NORMAL (n)</b> — A normal relationship between
        separately-created objects. The dependent object may be dropped without affecting the
        referenced object. The referenced object may only be dropped by specifying
          <codeph>CASCADE</codeph>, in which case the dependent object is dropped, too. Example: a
        table column has a normal dependency on its data type.</li>
      <li id="gk155724"><b>DEPENDENCY_AUTO (a)</b> — The dependent object can be dropped separately
        from the referenced object, and should be automatically dropped (regardless of
          <codeph>RESTRICT</codeph> or <codeph>CASCADE</codeph> mode) if the referenced object is
        dropped. Example: a named constraint on a table is made autodependent on the table, so that
        it will go away if the table is dropped.</li>
      <li id="gk155727"><b>DEPENDENCY_INTERNAL (i)</b> — The dependent object was created as part of
        creation of the referenced object, and is really just a part of its internal implementation.
        A <codeph>DROP</codeph> of the dependent object will be disallowed outright (we'll tell the
        user to issue a <codeph>DROP</codeph> against the referenced object, instead). A
          <codeph>DROP</codeph> of the referenced object will be propagated through to drop the
        dependent object whether <codeph>CASCADE</codeph> is specified or not.</li>
      <li id="gk155730"><b>DEPENDENCY_PIN (p)</b> — There is no dependent object; this type of entry
        is a signal that the system itself depends on the referenced object, and so that object must
        never be deleted. Entries of this type are created only by system initialization. The
        columns for the dependent object contain zeroes.<table id="gk143898"
            ><title>pg_catalog.pg_depend</title><tgroup cols="4"><colspec colnum="1" colname="col1"
              colwidth="131pt"/><colspec colnum="2" colname="col2" colwidth="86pt"/><colspec
              colnum="3" colname="col3" colwidth="85pt"/><colspec colnum="4" colname="col4"
              colwidth="147pt"/><thead><row><entry colname="col1">column</entry><entry
                  colname="col2">type</entry><entry colname="col3">references</entry><entry
                  colname="col4">description</entry></row></thead><tbody><row><entry colname="col1"
                    ><codeph>classid</codeph></entry><entry colname="col2">oid</entry><entry
                  colname="col3">pg_class.oid</entry><entry colname="col4">The OID of the system
                  catalog the dependent object is in.</entry></row><row><entry colname="col1"
                    ><codeph>objid</codeph></entry><entry colname="col2">oid</entry><entry
                  colname="col3">any OID column</entry><entry colname="col4"> The OID of the
                  specific dependent object.</entry></row><row><entry colname="col1"
                    ><codeph>objsubid </codeph></entry><entry colname="col2">int4</entry><entry
                  colname="col3"/><entry colname="col4">For a table column, this is the column
                  number. For all other object types, this column is zero.</entry></row><row><entry
                  colname="col1"><codeph>refclassid</codeph></entry><entry colname="col2"
                  >oid</entry><entry colname="col3">pg_class.oid</entry><entry colname="col4">The
                  OID of the system catalog the referenced object is in.</entry></row><row><entry
                  colname="col1"><codeph>refobjid</codeph></entry><entry colname="col2"
                  >oid</entry><entry colname="col3">any OID column</entry><entry colname="col4">The
                  OID of the specific referenced object.</entry></row><row><entry colname="col1"
                    ><codeph>refobjsubid </codeph></entry><entry colname="col2">int4</entry><entry
                  colname="col3"/><entry colname="col4">For a table column, this is the referenced
                  column number. For all other object types, this column is
                  zero.</entry></row><row><entry colname="col1"
                  ><codeph>deptype</codeph></entry><entry colname="col2">char</entry><entry
                  colname="col3"/><entry colname="col4">A code defining the specific semantics of
                  this dependency relationship.</entry></row></tbody></tgroup></table></li>
    </ul>
  </body>
</topic>
